<?php 
include "includes/sesiones.php";
include "includes/comunes.php";
error_reporting(0);

if($_GET['grabar']){
$sql="INSERT INTO cob_gestiones
 (`GestionFecha`, 
 `GestionOperador`,
 `GestionTipo`, 
 `GestionCredito`,
 `GestionCliente`,
 `GestionComentario`) 
 VALUES 
 ('".date("Y-m-d H:i:s")."', 
 ".$_GET['operador'].",
 ".$_GET['tipo'].",
 ".$_GET['cre_id'].",
 ".$_GET['cliente'].",
 '".$_GET['comentario']."')
";
$rescli= cons_ins($sql);
}


$sql="select  * from creditos where id=".trim($_GET['cre_id']);
$rescli= cons_ins($sql);
$reg=mysql_fetch_array($rescli);

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<!--libreria jquery central-->
<script src="jquery-ui/js/jquery-1.9.1.js"></script>
<!--fin libreria central-->
<!--librerias ui-->
<link href="jquery-ui/css/ui-lightness/jquery-ui-1.10.2.custom.css" rel="stylesheet"/>
<script src="jquery-ui/js/jquery-ui-1.10.2.custom.js"></script>
<!--fin libreria-->
<?php include "includes/metas.php";?>
<script language="JavaScript" type="text/javascript">
$(function()
{
 $('#vis').tooltip({
      track: true
    });
});
</script>
</head>

<body>
<div class="contenedor">
	<div class="cont">
   
        <div class="novedadescont">
        	<div class="novedadestitulo">
            	 <div class="novetitulo2">Credito <?php echo $reg['id']?> <?php echo $reg['cliente']?> - <?php echo obtener_cliente($reg['cliente'])?></div></div>
            </div>
           
            <form method="GET" action="nuevaGestion.php">
			 <div style="float:left;width:370px;">
			 <fieldset id="fieldset">
			 <legend><b>Datos del Credito</b></legend>
			 <table>
			 <tr>
			 <td  class="formtxt">Financiera:</td>
			 <td ><b><?php echo obtener_financiera($reg['financiera'])?></b></td>
			 </tr>
			 <tr>
			 <td  class="formtxt">Fecha:</td>
			 <td ><b><?php echo format_fec($reg['fecha'],"/")?></b></td>
			 </tr>
			 <tr>
			 <td  class="formtxt">Capital:</td>
			 <td><b> $<?php echo $reg['monto']?></b></td>
			 </tr>
			 </table>
			 </fieldset>
			 </div>
			 <div style="float:left;width:370px;">
			<fieldset id="fieldset">
			 <legend><b>Datos del Cliente</b></legend>
			 <table>
			 <tr>
			 <td  class="formtxt">Direccion:</td>
			 <td ><b><?php echo obtener_cliente_dir($reg['cliente'])?></b></td>
			 </tr>
			 <tr>
			 <td  class="formtxt">Telefono:</td>
			 <td ><b><?php echo obtener_cliente_tel($reg['cliente'])?></b></td>
			 </tr>
			 <tr>
			 <td  class="formtxt">Can.Cred:</td>
			 <td><b> <?php echo obtener_creditos($reg['cliente'])?></b></td>
			 </tr>
			 </table>
			 </fieldset>
			 </div>
			 <div style="float:left;width:740px;">
			 </div>
			 <div style="float:left;width:740px;">
			<fieldset id="fieldset">
			 <legend><b>Historial de contactos</b></legend>
			 <table>
			 <tbody>
			 <td><b>Numero</b></td>
			 <td><b>Fecha</b></td>
			 <td><b>Tipo</b></td>
			 <td><b>Comentario</b></td>
			 </tbody>
			 <?php 
			 $sql="select * from cob_gestiones where GestionCredito=".$reg['id']." order by GestionFecha desc";
			 $resGes=cons_ins($sql);
			 if (mysql_num_rows($resGes)>0):
			 while($regGes=mysql_fetch_array($resGes)):
			 ?>
			 <tr>
			 <?php if($_GET['nro']==$regGes['GestionId']):?>
			 <td bgcolor="red"><?php echo $regGes['GestionId']?></td>
			 <?php else:?>
			 <td><?php echo $regGes['GestionId']?></td>
			 <?php endif?>
			 <td><?php echo format_fec($regGes['GestionFecha'],"/")?></td>
			 <td><?php echo tipo_gestion($regGes['GestionTipo'])?></td>
			 <td><?php echo utf8_encode($regGes['GestionComentario'])?></td>
			 </tr>
			<?php 
			endwhile;
			endif?>
			 </table>
			 </fieldset>
			 </form>
			 </div>

 
               


            

            <div class="novedadesbottom"></div>
        </div>

    
    
	<div id="clearing"></div>    
    </div>
<div id="clearing"></div>
</div>
</body>
</html>
